<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <style type="text/css">
        /* tooltip */
        #tooltip{
            position:absolute;
            border:1px solid #ccc;
            background:#333;
            padding:2px;
            display:none;
            color:#fff;
        }
        tr>td{
            text-align: center;
        }
    </style>
</head>
<body style="padding:10px;">
    <div class="tplay-body-div">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">骰盅管理</li             >
                <li><a href="{:url('admin/goods/publish')}" class="a_menu">新增骰盅</a></li>
            </ul>
        </div>

        <form class="layui-form serch" action="{:url('admin/goods/index')}" method="post">
            <div class="layui-form-item" style="float: left;">
                <div class="layui-input-inline">
                    <input type="text" name="keywords" lay-verify="title" autocomplete="off" placeholder="请输入名称" class="layui-input layui-btn-sm">
                </div>

                <div class="layui-input-inline">
                </div>

                <div class="layui-input-inline">
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="create_time" placeholder="创建时间" name="create_time">
                        </div>
                    </div>
                </div>

                <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">检索</button>
            </div>
        </form>

        <table class="layui-table" lay-size="sm">
            <colgroup>
                <col width="80">
                <col width="100">
                <col width="100">
                <col width="80">
                <col width="250">
                <col width="80">
                <col width="80">
                <col width="80">
                <col width="80">
                <col width="150">
                <col width="150">
                <col width="100">
            </colgroup>
            <thead>
                <tr>
                    <th style="text-align: center">道具编号</th>
                    <th style="text-align: center">名称</th>
                    <th style="text-align: center">价格</th>
                    <th style="text-align: center">解锁方式</th>
                    <th style="text-align: center">描述</th>
                    <th style="text-align: center">库存量</th>
                    <th style="text-align: center">最低购买等级</th>
                    <th style="text-align: center">允许购买</th>
                    <th style="text-align: center">允许赠送</th>
                    <th style="text-align: center">创建时间</th>
                    <th style="text-align: center">更新时间</th>
                    <th style="text-align: center">操作</th>
                </tr>
            </thead>
            <tbody>
                {volist name="goods" id="vo"}
                <tr>
                    <td >{$vo.image_id}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.price}</td>
                    <td>{if condition="$vo.unlock_way eq 1"}旗力币购买{else/}活动赠送{/if}</td>
                    <td>{$vo.content}</td>
                    <td>{$vo.storage}</td>
                    <td>{$vo.grade}</td>
                    <td>{if condition="$vo.allow_buy eq 1"}允许{else/}禁止{/if}</td>
                    <td>{if condition="$vo.allow_send eq 1"}允许{else/}禁止{/if}</td>
                    <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
                    <td>{if condition="$vo.update_time eq '0'"}----{else/}{$vo.update_time|date="Y-m-d H:i:s",###}{/if}</td>
                    <td class="operation-menu">
                        <div class="layui-btn-group">
                            <a href="{:url('goods/update',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu layui-btn-primary" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
                            <a class="layui-btn layui-btn-xs layui-btn-primary delete" id="{$vo.id}" style="margin-right: 0;font-size:12px;"><i class="layui-icon"></i></a>
                        </div>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>

        <div style="padding:0 20px;">{$goods->render()}</div>
        {include file="public/foot"}
    </div>
</body>
</html>
<script type="text/javascript">
    $('.delete').click(function(){
        var id = $(this).attr('id');
        layer.confirm('确定要删除?', function(index) {
            $.ajax({
                url:"{:url('admin/goods/delete')}",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                          location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    })
</script>
